<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品信息数据列表</title>
	<include file="Public:header" />
	<style type="text/css">
		.input{width:190px; border:1px solid #ccc; padding:2px;}
		.select{width:190px; border:1px solid #ccc; height:25px; padding:2px; margin:-5px auto;}
	</style>
	<script type="text/javascript">
		var actflg="{:C('URL_MODEL')}"=="0"?"&":"?";
		function delete_todo()
		{
			var selChk="";
			//遍历得到每个checkbox的value值
			$("input[name='chk_list']").each(function(){
				if(this.checked){selChk+=this.value+",";}				
			});
			selChk+="0";
			if(selChk=="0")
			{
				$.messager.show({title:'提示',msg:'没有选中要删除的项',timeout:5000,showType:'slide'});
			}
			else
			{
				$.messager.confirm('询问', '确认要删除选中的项吗？', function(r){
					if (r){
						//todo...
						window.location.href="{:U('Stk/data_del')}"+actflg+"id="+selChk+"";
					}
				});
			}
		}
		
		function data_status_to_y()
		{
			var selChk="";
			//遍历得到每个checkbox的value值
			$("input[name='chk_list']").each(function(){
				if(this.checked){selChk+=this.value+",";}				
			});
			selChk+="0";
			if(selChk=="0")
			{
				$.messager.show({title:'提示',msg:'没有选中要启用的项',timeout:5000,showType:'slide'});
			}
			else
			{
				$.messager.confirm('询问', '确认要启用选中的项吗？', function(r){
					if (r){
						//todo...
						window.location.href="{:U('Stk/data_status_to_y')}"+actflg+"id="+selChk+"";
					}
				});
			}
		}
		
		function data_status_to_n()
		{
			var selChk="";
			//遍历得到每个checkbox的value值
			$("input[name='chk_list']").each(function(){
				if(this.checked){selChk+=this.value+",";}				
			});
			selChk+="0";
			if(selChk=="0")
			{
				$.messager.show({title:'提示',msg:'没有选中要禁用的项',timeout:5000,showType:'slide'});
			}
			else
			{
				$.messager.confirm('询问', '确认要禁用选中的项吗？', function(r){
					if (r){
						//todo...
						window.location.href="{:U('Stk/data_status_to_n')}"+actflg+"id="+selChk+"";
					}
				});
			}
		}
		
		function data_move_byid()
		{
			var selChk="";
			//var classid=$("#classid").attr("value");
			var classid=$('#classid').combobox('getValue');
			//遍历得到每个checkbox的value值
			$("input[name='chk_list']").each(function(){
				if(this.checked){selChk+=this.value+",";}				
			});
			selChk+="0";
			if(selChk=="0")
			{
				$.messager.show({title:'提示',msg:'没有选中要转移的项',timeout:5000,showType:'slide'});
			}
			else if(classid=="")
			{
				$.messager.show({title:'提示',msg:'没有目标类别',timeout:5000,showType:'slide'});
			}
			else
			{
				$.messager.confirm('询问', '确认要转移选中的项到新的类别吗？', function(r){
					if (r){
						//todo...
						window.location.href="{:U('Stk/data_move_byid')}"+actflg+"id="+selChk+"&classid="+classid+"";
					}
				});
			}
		}
		
		function data_move_byclass()
		{
			//var oldcid=$("#cid").attr("value");
			//var classid=$("#classid").attr("value");
			var oldcid=$('#cid').combobox('getValue');
			var classid=$('#classid').combobox('getValue');
			if(oldcid=="")
			{
				$.messager.show({title:'提示',msg:'没有选中要转移的类别',timeout:5000,showType:'slide'});
			}
			else if(oldcid==classid)
			{
				$.messager.show({title:'提示',msg:'原类别与新类别相同，不需要转移',timeout:5000,showType:'slide'});
			}
			else
			{
				$.messager.confirm('询问', '确认要转移到新的类别吗？', function(r){
					if (r){
						//todo...
						window.location.href="{:U('Stk/data_move_byclass')}"+actflg+"oldclassid="+oldcid+"&classid="+classid+"";
					}
				});
			}
		}
		
		function selectall_todo()
		{
			$("input[name='chk_list']").attr("checked",true);
		}
		function selectall_undo()
		{
			$("input[name='chk_list']").attr("checked",false);
		}
	</script>
</head>
<body class="">
	<div class="demo-info space-out-5px">
		<div class="demo-tip icon-tip"></div>
		<div>商品是公司营运的主体内容，这里可以维护商品信息</div>
		<div>
		<form id="frm_search" method="post" action="{:U('Stk/data_list')}" style="margin:10px auto 0px 25px;">
		<div style="float:left; margin:0px; padding:2px;">
		<select id="cid" name="cid" class="easyui-combobox" editable="false" style="width:190px;">
								<option value='0'>顶级类别</option>
								<volist name='classlist' id="classlist">
								<option value='{$classlist["id"]}'><for start="2" end="$classlist['count']">|----</for>{$classlist['classname']}</option>
								</volist>
		</select>
		</div>
		<script type="text/javascript">$("#cid").attr("value","{$cid}");</script>
		<input type="text" id="keywords" name="keywords" class="input" value="{$keywords}" />
		<a href="javascript:;" class="easyui-linkbutton" iconCls="icon-search" onclick="$('#frm_search').submit();">搜索</a>
		<a href="{:U('Stk/data_list')}" class="easyui-linkbutton" iconCls="icon-reload">显示所有</a>
        <a href="javascript:;" class="easyui-linkbutton" iconCls="icon-print" style="display:;" onclick="window.open('{:U('Stk/data_print')}?cid={$cid}&keywords={$keywords}');">打印</a>		
		<a href="{:U('Stk/data_list_rec')}" class="easyui-linkbutton" iconCls="icon-rec">回收站</a>
		<a href="{:U('Stk/data_add')}" class="easyui-linkbutton" iconCls="icon-add">新增商品</a>
		</form>
		</div>
	</div>
	<div class=" space-out-10px">
	
	<div class="list-title">
		<div class="list-t-l w50px"></div>
		<div class="list-t-l w50px">ID</div>
        <div class="list-t-l w150px">商品编号/条码</div>
		<div class="list-t-l w200px">商品名称</div>		
		<div class="list-t-l w100px">单位</div>
        
        <div class="list-t-l w100px">规格</div>
        <div class="list-t-l w100px">产地</div>
        
		<div class="list-t-l w100px">采购价</div>
        <div class="list-t-l w100px">销售价</div>
		<div class="list-t-l w60px">状态</div>
		<div class="list-t-l">操作</div>
		<div class="list-t-r">		
		
		</div>
	</div>
	
	<div class="list-box">
	<volist name="datalist" id="datalist">
	<div class="list-body">
		<div class="list-t-l w50px"><input type="checkbox" name="chk_list" value="{$datalist.id}" style="margin-top:6px;" /></div>
		<div class="list-t-l w50px">{$datalist.id}</div>
        <div class="list-t-l w150px">{$datalist.stk_c}</div>
		<div class="list-t-l w200px" alt="{$datalist.title}" title="{$datalist.title}">{$datalist.title}</div>		
		<div class="list-t-l w100px">{$datalist.uom}</div>
        
        <div class="list-t-l w100px">{$datalist.spec}</div>
        <div class="list-t-l w100px">{$datalist.madein}</div>
        
		<div class="list-t-l w100px">{$datalist.price_pur|get_round=###,6}</div>
        <div class="list-t-l w100px">{$datalist.price_sales|get_round=###,6}</div>
		<div class="list-t-l w60px"><img src="__PUBLIC__/Images/{$datalist.status_flg}.png" alt="{$datalist.status_flg}" title="{$datalist.status_flg}" /></div>
		<div class="list-t-l"><a href="{:U('Stk/data_edit?id='.$datalist['id'].'')}">编辑</a>
		</div>
	</div>
	</volist>
	</div>
	
	<div class="list-title">
		<div class="list-t-l">操作：<a href="javascript:;" onclick="selectall_todo()">全选</a> - <a href="javascript:;" onclick="selectall_undo()">取消选择</a>
		- <a href="javascript:;" onclick="delete_todo()">删除</a>
		- <a href="javascript:;" onclick="data_status_to_y()">启用</a>
		- <a href="javascript:;" onclick="data_status_to_n()">禁用</a>
		- <select id="classid" name="classid" class="easyui-combobox" editable="false" style="width:190px;">
								<option value='0'>顶级类别</option>
								<volist name='classlist2' id="classlist2">
								<option value='{$classlist2["id"]}'><for start="2" end="$classlist2['count']">|----</for>{$classlist2['classname']}</option>
								</volist>
		</select>
		<a href="javascript:;" class="easyui-linkbutton" iconCls="icon-reload" onclick="data_move_byid();" title="将选中的项转移到新的类别下">转移选中项</a>
		<a href="javascript:;" class="easyui-linkbutton" iconCls="icon-reload" onclick="data_move_byclass();" title="将所有项转移到新的类别下">转移所有</a>
		</div>
		<div class="list-t-r">
		
		<a href="{:U('Stk/data_add')}" class="easyui-linkbutton" iconCls="icon-add">新增商品</a>
		<a href="{:U('Stk/data_list_rec')}" class="easyui-linkbutton" iconCls="icon-rec"></a>
		</div>
	</div>
	
	</div>
	
	<div class="demo-info space-out-5px">
	<div class="demo-tip icon-tip"></div>
	<div class="pages">&nbsp;{$page}</div>
	</div>
</body>
</html>
